Information recording media that record digital data such as music contents and video contents include various types: a hard disk, an optical disk, etc. Memory cards as one type of these information recording media are small in size and light in weight, and thus are used mainly in small-sized mobile devices such as digital still cameras, mobile phone terminals, etc. and have become increasingly and rapidly widespread.
Predominant semiconductor memories currently used as recording devices of a memory card are flash memories such as an EEPROM and flash ROM. In particular, an NAND type flash memory used in many information recording media is characterized in that for the purpose of data writing, it needs to be put into an unrecorded state by erasing data recorded in a write destination before the data writing. Here, a unit in which data is erased is referred to as an erase block and managed as a block composed by a collection of a plurality of sectors each serving as a minimum unit for access.
FIG. 1 is a diagram showing one example of relationship between erase blocks and sectors in a flash memory. In the example of FIG. 1, one erase block is composed of 32 sectors. Access can be achieved in units of sectors, for example, 512 bytes (B), but data erase processing required prior to writing is performed in units of erase blocks, for example, 16 kB. For a capacity of a recording area, 64000 consecutive 16 kB-erase blocks are shown as an example.
To record data of one erase block (16 kB) into the flash memory, more specifically, record processing is executed in the following procedures:
(1) Interpreting a command inputted from an access device;
(2) Acquiring one erase block where no valid data is stored and then erase data in the erase block (equivalent to one erase block); and
(3) Recording inputted data of one erase block from the access device into the erase block from which the data has been erased at (2).
To record data of one sector (512B) into the flash memory, record processing is executed in the following procedures:
(1) Interpreting a command inputted from the access device;
(2) Acquiring one erase block where no valid data is stored and then erase data in the erase block (equivalent to one erase block);
(3) Recording inputted data of one sector from the access device into the erase block from which the data has been erased at (2); and
(4) Copying valid data of another erase block into the remaining 31 sectors of the erase block on which one-sector recording has been done.
As described above, the record processing performed on the NAND type flash memory includes three major processing: command interpretation processing, data erase processing, and data record processing.
For example, assume a NAND type flash memory that requires 3 msec. for the command interpretation processing, 200 μsec. for the processing of recording data of one sector, and 2 msec. for the processing of erasing one erase block (16 kB). To record data of one erase block (16 kB) into this NAND type flash memory according to the recording procedures indicated above, it requires 3 msec. for the command interpretation, 2 msec. for the erasing processing, and 32×200 μsec. for the data record processing, thus requiring a total processing time of 11.4 msec. Similarly, to record data of one sector (512B), it requires 3 msec. for the command interpretation, 2 msec for the erasing processing, and 200 μsec.+31×200 μsec. for the data record processing, thus requiring a total processing time of 11.4 msec.
Therefore, almost the same length of time is required for writing data of 16 kB (one erase block, 32 sectors) and for writing data of 512B (one sector). Comparison after conversion of the processing time into time required for writing per sector shows that shorter time is required for recording data of one erase block. The description of this example refers to a case where an extremely large difference in performance is observed without consideration of data transfer time, etc., but even on an actual NAND type flash memory, the write time is smallest when writing is performed in units of erase blocks.
Here, the characteristics of the NAND type flash memory have been described, and the same applies to a hard disk, an optical disk, and the like. In recording into non-consecutive addresses in small units, seek processing that physically moves a magnetic head or an optical head occurs frequently, which requires much time for processing other than data writing, thereby resulting in a decreased recording speed. Similarly to the NAND type flash memory, they have a characteristic that they can achieve collective recording into consecutive areas at higher speed than recording into non-consecutive positions in small units.
On the other hand, data stored in an information recording medium is managed by a file system, so that the user can handle the stored data as a file with ease. File systems conventionally used include: a FAT file system, a UDF (Universal Disk Format) file system, an NTFS file system (New Technology File system), etc. Memory cards with data managed by these file systems can be shared among devices interpreting the same file system, which permits data supply and reception among the devices.
As one example of the file systems, the FAT file system will be described. FIG. 2 shows a configuration of the FAT file system. The file system is built on a logical address space inside an information recording medium. Found at the top of the logical address space in the FAT file system is a file system management information area 301 storing management information for an entire area managed by the FAT file system. Found following this is a user data area 302 in which data inside the file, etc. is stored. The file system management information area 301 is composed of: a master boot record-partition table (MBR-PT) 303, partition boot sector (PBS) 304, FATs 305 and 306 as area management information, and a root directory entry (RDE) 307.
The MBR-PT 303 is a portion storing information for dividing the entire area on the logical address space managed by the file system into a plurality of areas and managing them individually as partitions. The PBS 304 is a portion in which management information inside one partition is stored. The FATs 305 and 306 are portions indicating physical storage position of data included in a file. Further, the RDE 307 is a portion storing information on a file and directory found immediately below a root directory. Moreover, since the FATs 305 and 306 are important areas indicating the physical storage position of data included in the file, the FAT 305 and FAT 306 which have the same information are usually present in the file system management information area 301, thereby achieving duplication for safety.
The user data area 302 is divided into management units called clusters in all the area thereof for management, each of which stores data included in the file. The typical cluster size is approximately 512B to 32 kB. When a file size is larger than the cluster size, the data included in the file is stored striding over a plurality of clusters, and association between the clusters is managed by link information stored in the FATs 305 and 306.
FIGS. 3A, 3B, and 3C show, each as one example, a directory entry 401, FATs 305 and 306, and a user data area 302, respectively, in the FAT file system. The FAT file system stores the directory entry 401 that stores information such as a file name, file size, file attribute, etc. in the RDE 307 and a part of the user data area 302. The directory entry 401 includes a file name, attribute, time stamp, start cluster number, and file size.
The directory entry shown in an example of FIG. 3A stores information related to a file whose file name is “FILE1.TXT”. The head portion of data included in this file is stored in a cluster with cluster number 10, and the file size is 64000B. Moreover, in FIG. 3A, the file size is 64000B. Here, it is assumed that the size of one cluster is 16384B; thus, the data of “FILE1.TXT” is stored striding over four clusters.
The FATs 305 and 306 have the same number of FAT entries as the number of clusters present in the user data area 302. Each of the FAT entries as entry information serving as a management unit stores a use state of the corresponding cluster and information on link between the clusters.
An example of FIG. 3B shows that “0x000B (11)” is stored as a FAT entry value for cluster number 10 and a cluster with cluster number 10 is linked to a cluster with cluster number 11. Similarly, cluster number 11 with “0x000C (12)” as its FAT entry value is linked to a cluster with cluster number 12, cluster number 12 with “0x000D (13)” as its FAT entry value is linked to a cluster with cluster number 13, and cluster number 13 stores “0xFFFF” stored as its FAT entry value.
The “0XFFFF” in the FAT entry value indicates the end of the file; therefore, the data of “FILE1.TXT” is stored striding over the four clusters with cluster numbers 10, 11, 12, and 13. Moreover, as a FAT entry value for cluster number 14, “0x0000” is stored. The “0x0000” in the FAT entry value means an empty cluster; therefore, no valid data is stored in cluster number 14.
The user data area 302 stores contents of file data, and in an example of FIG. 3C, contents of the data of “FILE1.TXT” is recorded in the four clusters with cluster numbers 10, 11, 12, and 13. That is, to record file data by using the FAT file system, it is required to record the file data into the user data area 302 and also at the same time record the directory entry 401 and the FATs 305 and 306.
Here, assume a case where, by using a portable movie or the like, moving image data is recorded in real time into an information recording medium managed by the FAT file system. In recording data requiring such real time performance, a speed at which the moving image data is inputted and a speed at which it is recorded differ from each other; thus, when the speed of data input is faster than that of data record, an overflow may occur in a buffer temporally saving the input data, thus stopping the data recording. To prevent this, it is required to perform recording to the information recording medium at higher speed than the generation speed of input data.
An information recording medium such as a flash memory, hard disk, or optical disk, however, has a characteristic of data writing time as described above. And, when recording in small units continues, the speed of recording into the information recording medium may become lower than the speed of input data generation. The real time data recording may result in stopping.
Suggested as a conventional method to solve such a problem is a method of separately using a free recording area of a long area length and a free recording area of a short area length in accordance with the speed required for data reading and writing (Patent Document 1). In this method, when high-speed recording of real time data or the like is required, recording into the free recording area of a long area length is performed to achieve the high-speed recording, while for data such as a still image that can be recorded even at a relatively low speed, recording to the free recording area of a short area length is performed. Such separate use achieves effective use of the recording areas while insuring the real time performance.
Patent Document 1: Japanese Unexamined Patent Publication No. Hei 9-251407